package com.utc.teamcenter.common.util;

import com.teamcenter.rac.kernel.TCComponentReleaseStatus;
import com.teamcenter.rac.kernel.TCComponentReleaseStatusType;
import com.teamcenter.rac.kernel.TCException;

public class StatusUtil {
	private static final String RELEASE_STATUS = "ReleaseStatus";

	private StatusUtil() {

	}

	public static TCComponentReleaseStatusType getStatusType(String formType)
			 {
		try {
			return (TCComponentReleaseStatusType) TCUtil.getTypeComponent(formType);
		} catch (TCException e) {
			e.printStackTrace();
		}
		return null;
	}

	public static TCComponentReleaseStatus createRelease(String releasedType)
			 {
		TCComponentReleaseStatusType statusType = getStatusType(RELEASE_STATUS);
		TCComponentReleaseStatus statusItem = null;
		try {
			statusItem = (TCComponentReleaseStatus) statusType
					.create(releasedType);

			statusItem.save();
		} catch (TCException e) {
			e.printStackTrace();
		}
		return statusItem;
	}

	public static void addStatusToComponent() {

	}
}
